/**
 * 基本的数据结构，和一些基本的库函数，设置debug模式
 * module.h
 */
#ifndef __MODULE_H__
#define __MODULE_H__ 

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>

// #ifndef __GAMETAG__
// #define __GAMETAG__ 

// #define PRIME '0'
// #define FAST	'1'
// #define COMMON	'2'

// #endif 	/* __GAMETAG__ */

// #ifndef __STATUS__
// #define __STATUS__ 

// #define OK 		 1
// #define FAIL	-1

// #endif	/* __STATUS__ */

#define __DEBUG__

#ifdef 	__DEBUG__
#define debug(fmt, ...) fprintf(stdout, ">>>"fmt"\n", ##__VA_ARGS__);
#else
#define debug(fmt, ...)
#endif	/* __DEBUG__ */

#define CLUBNAME_LEN 20
#define PERSON_LEN 10

/**
 * 参赛俱乐部基本信息
 */
struct club
{
	char name[CLUBNAME_LEN];
	char coach[PERSON_LEN];
	
	//场分
	int sitepoint;
	
	//局分
	int gamepoint;

	//指向俱乐部成员
	struct player *player;

	struct club *next;
};


/**
 * 参赛棋手基本信息
 */
struct player
{
	char clubname[CLUBNAME_LEN];
	char name[PERSON_LEN];

	//段位
	char rank;

	//参赛局数
	int gamesum;

	//胜局数
	int victories;

	//指向俱乐部
	struct club *club;

	//指向对局
	struct game *game;

	struct player *next;
};


/**
 * 围棋对局基本信息
 */
struct game
{
	int id;
	
	//局别,'0'、'1'、'2'分别表示主将局、快棋局和普通局
	char tag;

	//执黑棋手
	char black[PERSON_LEN];

	char white[PERSON_LEN];

	//胜负,'0'、'1'分别表示黑胜、白胜
	char status;

	char blackteam[CLUBNAME_LEN];

	char whiteteam[CLUBNAME_LEN];

	//指向参赛棋手
	struct player *player;

	struct game *next;
};


struct list
{
	int id;

	char tag;

	char black[PERSON_LEN];

	char white[PERSON_LEN];

	char player[PERSON_LEN];

	char status;

	struct list *next;
};


struct club_t
{
	char name[CLUBNAME_LEN];
	char coach[PERSON_LEN];
	
	//场分
	int sitepoint;
	
	//局分
	int gamepoint;
};


struct player_t
{
	char clubname[CLUBNAME_LEN];
	char name[PERSON_LEN];

	//段位
	char rank;

	//参赛局数
	int gamesum;

	//胜局数
	int victories;
};


struct game_t	
{
	char clubname[CLUBNAME_LEN];

	char player[PERSON_LEN];

	int id;
	
	//局别,'0'、'1'、'2'分别表示主将局、快棋局和普通局
	char tag;

	//执黑棋手
	char black[PERSON_LEN];

	char white[PERSON_LEN];

	//胜负,'0'、'1'分别表示黑胜、白胜
	char status;

	char blackteam[CLUBNAME_LEN];

	char whiteteam[CLUBNAME_LEN];
};


struct rank
{
	char clubname[CLUBNAME_LEN];

	char coach[PERSON_LEN];

	int sitepoint;

	int gamepoint;

	int win;

	int lose;

	struct rank *next;
};


typedef struct club Club;
typedef struct player Player;
typedef struct game Game;
typedef struct list List;
typedef struct club_t Club_t;
typedef struct player_t Player_t;
typedef struct game_t Game_t;
typedef struct rank Rank;


#endif